package com.blocks.mq.producer;

import com.blocks.mq.producer.entity.Student;
import com.blocks.mq.producer.repository.StudentRepository;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author
 */
@SpringBootApplication
@EnableJms
public class MqProducerApplication {

    public static void main(String[] args) {
        SpringApplication.run(MqProducerApplication.class, args);
    }

    @Component
    public static class ApplicationRunnerImpl implements ApplicationRunner {

        @Resource
        StudentRepository studentRepository;

        @Override
        public void run(ApplicationArguments args) {
            List<Student> all = studentRepository.findAll();
            System.out.println(all);
        }
    }
}
